package edu.berkeley.cs160.innovationers.shoppersidekick;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

public class AddList extends Activity implements OnClickListener{
	
	EditText myTitle;
	
	public void onClick(View view) {
		switch(view.getId()) {
		case (R.id.CancelButton):
			setResult(myApp.noChange,null);
			finish();
			break;
		case (R.id.OKButton):
			Intent resultIntent=new Intent();
			resultIntent.putExtra("CONTENT", myTitle.getText().toString());
			setResult(myApp.newList,resultIntent);
			finish();
			break;
		}
	}
	
    public void onCreate(Bundle savedInstanceState) {
        
    	super.onCreate(savedInstanceState);
        
        setContentView(R.layout.addlist);  
        getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        setTitle("New List Name");
        myTitle=(EditText)findViewById(R.id.ListName);
        Button myCancelButton=(Button)findViewById(R.id.CancelButton);
        Button myOKButton=(Button)findViewById(R.id.OKButton);
        
        myCancelButton.setOnClickListener(this);
        myOKButton.setOnClickListener(this);

    }
}
